package com.example.tests;

import static org.junit.Assert.*;

import org.junit.*;

import com.example.model.SortedListOf;
import com.example.model.User;
import com.example.pages.UsersPage;

public class DeleteUserTest extends TestBase{
  

  @Test
  public void testDeleteNewUser(){
    UsersPage usersPage = goToMainPage()
    	.loginWithValidCredentials("admin", "admin")
    	.gotoUserManagement();
    	
    SortedListOf<User>	oldUserList = usersPage.getUsers();
    User user = new User()
    	.withName("user").withEmail("user@test.com");
    if (oldUserList.contains(user)){
    	usersPage.deleteUser(user);
        SortedListOf<User>	newUserList = usersPage.getUsers();
        assertEquals("User was not removed",oldUserList.without(user), newUserList);
    }
    else{
    	assertTrue("No user to remove",false);
    }

    
	//assertTrue("Not on Login Page!", loginPage.IsOnThisPage());
	//assertTrue("Not on Login Page!",driver.findElements(By.id("loginform")).size() > 0);
  }
  

  
}
